﻿using log4net;
using log4net.Config;
using log4net.Core;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace commonFramwork.Log
{
    public class MyuLogger
    {

        private ILog loger = null;

        public MyuLogger(Type type)
        {
            loger = LogManager.GetLogger(type);
        }
     
        static MyuLogger()
        {
            var configFile = new System.IO.FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "CfgFiles\\log4net.cfg.xml"));
            if (!configFile.Exists)
            {
                throw new Exception("未配置log4net配置文件！");
            }

            XmlConfigurator.Configure(configFile);
        }

        public void Warn(string str)
        {
            loger.Warn(str);
        }


        public void Info(string str)
        {
            loger.Info(str);
        }


        public void Error(string str)
        {
            loger.Error(str);
        }



        public void Fatal(string str)
        {
            loger.Fatal(str);
        }


        public void Debug(string str)
        {
            loger.Debug(str);
        }
    }
}
